package com.fulong.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.fulong.entity.UserMsgInfoEntity;
import com.fulong.service.UserMsgInfoService;
import com.fulong.common.utils.PageUtils;
import com.fulong.common.utils.R;



/**
 * 
 *
 * @author fulong
 * @email ${email}
 * @date 2022-03-24 11:18:03
 */
@RestController
@RequestMapping("/usermsginfo")
public class UserMsgInfoController {
    @Autowired
    private UserMsgInfoService userMsgInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userMsgInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
		UserMsgInfoEntity userMsgInfo = userMsgInfoService.getById(id);

        return R.ok().put("userMsgInfo", userMsgInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody UserMsgInfoEntity userMsgInfo){
		userMsgInfoService.save(userMsgInfo);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserMsgInfoEntity userMsgInfo){
		userMsgInfoService.updateById(userMsgInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] ids){
		userMsgInfoService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
